/**
 * 
 * @file authz.c
 * @brief Authorization module
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "http_status.h"
#include "authz.h"

int check_user_access(request_rec *r) {
	FILE *ifp = fopen(".htaccess", "r");
	if (ifp) { // if file .htaccess, then authentication is required.
		return HTTP_UNAUTHORIZED;
	}
	else {
		return OK;
	}
}

void register_authz(request_rec *r) {
    run_auth_checker = check_user_access;
}
